$SIG{'__DIE__'} = sub {
    utf8::decode( $_[0] ) unless utf8::is_utf8( $_[0] );

    $main::log->Fatal( $_[0] );

    $main::log->Note('terminating...') and exit( 1 );
};

$SIG{'__WARN__'} = sub {
    utf8::decode( $_[0] ) unless utf8::is_utf8( $_[0] );

    $main::log->Warn( $_[0] );
};

1;
